<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Vector Operations (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Vector Operations (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Vector Operations (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="RTL.html" rel="up" title="RTL">
<link href="Conversions.html" rel="next" title="Conversions">
<link href="Bit_002dFields.html" rel="prev" title="Bit-Fields">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en">
<div class="section-level-extent" id="Vector-Operations">
<div class="nav-panel">
<p>
Next: <a href="Conversions.html" accesskey="n" rel="next">Conversions</a>, Previous: <a href="Bit_002dFields.html" accesskey="p" rel="prev">Bit-Fields</a>, Up: <a href="RTL.html" accesskey="u" rel="up">RTL Representation</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Vector-Operations-1"><span>14.12 Vector Operations<a class="copiable-link" href="#Vector-Operations-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-vector-operations"></a>

<p>All normal RTL expressions can be used with vector modes; they are
interpreted as operating on each part of the vector independently.
Additionally, there are a few new expressions to describe specific vector
operations.
</p>
<dl class="table">
<dt><a id="index-vec_005fmerge"></a><span><code class="code">(vec_merge:<var class="var">m</var> <var class="var">vec1</var> <var class="var">vec2</var> <var class="var">items</var>)</code><a class="copiable-link" href="#index-vec_005fmerge"> &para;</a></span></dt>
<dd><p>This describes a merge operation between two vectors.  The result is a vector
of mode <var class="var">m</var>; its elements are selected from either <var class="var">vec1</var> or
<var class="var">vec2</var>.  Which elements are selected is described by <var class="var">items</var>, which
is a bit mask represented by a <code class="code">const_int</code>; a zero bit indicates the
corresponding element in the result vector is taken from <var class="var">vec2</var> while
a set bit indicates it is taken from <var class="var">vec1</var>.
</p>
</dd>
<dt><a id="index-vec_005fselect"></a><span><code class="code">(vec_select:<var class="var">m</var> <var class="var">vec1</var> <var class="var">selection</var>)</code><a class="copiable-link" href="#index-vec_005fselect"> &para;</a></span></dt>
<dd><p>This describes an operation that selects parts of a vector.  <var class="var">vec1</var> is
the source vector, and <var class="var">selection</var> is a <code class="code">parallel</code> that contains a
<code class="code">const_int</code> (or another expression, if the selection can be made at
runtime) for each of the subparts of the result vector, giving the number of
the source subpart that should be stored into it.  The result mode <var class="var">m</var> is
either the submode for a single element of <var class="var">vec1</var> (if only one subpart is
selected), or another vector mode with that element submode (if multiple
subparts are selected).
</p>
</dd>
<dt><a id="index-vec_005fconcat"></a><span><code class="code">(vec_concat:<var class="var">m</var> <var class="var">x1</var> <var class="var">x2</var>)</code><a class="copiable-link" href="#index-vec_005fconcat"> &para;</a></span></dt>
<dd><p>Describes a vector concat operation.  The result is a concatenation of the
vectors or scalars <var class="var">x1</var> and <var class="var">x2</var>; its length is the sum of the
lengths of the two inputs.
</p>
</dd>
<dt><a id="index-vec_005fduplicate"></a><span><code class="code">(vec_duplicate:<var class="var">m</var> <var class="var">x</var>)</code><a class="copiable-link" href="#index-vec_005fduplicate"> &para;</a></span></dt>
<dd><p>This operation converts a scalar into a vector or a small vector into a
larger one by duplicating the input values.  The output vector mode must have
the same submodes as the input vector mode or the scalar modes, and the
number of output parts must be an integer multiple of the number of input
parts.
</p>
</dd>
<dt><a id="index-vec_005fseries"></a><span><code class="code">(vec_series:<var class="var">m</var> <var class="var">base</var> <var class="var">step</var>)</code><a class="copiable-link" href="#index-vec_005fseries"> &para;</a></span></dt>
<dd><p>This operation creates a vector in which element <var class="var">i</var> is equal to
&lsquo;<samp class="samp"><var class="var">base</var> + <var class="var">i</var>*<var class="var">step</var></samp>&rsquo;.  <var class="var">m</var> must be a vector integer mode.
</p></dd>
</dl>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Conversions.html">Conversions</a>, Previous: <a href="Bit_002dFields.html">Bit-Fields</a>, Up: <a href="RTL.html">RTL Representation</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
